Fix LogLevel: CLI phase suppression and case-insensitive "Default" config key#3203
Fix LogLevel: CLI phase suppression and case-insensitive "Default" config key#3203
Conversation
…ive Default key Co-authored-by: RubenCerna2079 <32799214+RubenCerna2079@users.noreply.github.com>
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Addresses two logging-related startup issues: (1) honoring --LogLevel during early/CLI-phase output, and (2) treating the telemetry.log-level config key "default" case-insensitively so "Default" doesn’t crash startup.
Changes:
- Updates runtime-config log-level validation and lookup to be case-insensitive for
"default"/"Default". - Refactors service startup/config-loader logging to route messages through logging infrastructure (with buffering intended before final log level is known).
- Adjusts CLI E2E tests around
--LogLevelbehavior, splitting Information-and-below vs Warning-and-above scenarios.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Service/Startup.cs | Adds log buffering + runtime log-level update wiring during startup (and config-loader logger wiring). |
| src/Service/Program.cs | Adds dynamic filtering hooks intended to suppress early messages based on effective log level. |
| src/Config/FileSystemRuntimeConfigLoader.cs | Replaces direct console writes with logger/buffered logging and adds logger setter/flush. |
| src/Config/ObjectModel/RuntimeConfig.cs | Makes "default" log-level lookup case-insensitive in GetConfiguredLogLevel. |
| src/Core/Configurations/RuntimeConfigValidator.cs | Makes logger-filter validation case-insensitive. |
| src/Service.Tests/Configuration/ConfigurationTests.cs | Adds a test row covering "Default" log-level key validation. |
| src/Cli/Program.cs | Keeps CLI logger factory usage and loader creation (but currently still doesn’t wire args into log level). |
| src/Cli.Tests/EndToEndTests.cs | Updates E2E coverage for --LogLevel expectations and adds a Warning+ startup test. |
You can also share your feedback on Copilot code review. Take the survey.
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
Is the description up to date? I dont see these changes in the files, or was this renamed? |
|
How is the CustomConsoleLogger getting --loglevel? I think some changes were reverted and maybe the description isn't accurate anymore. |
aaronburtle
left a comment
There was a problem hiding this comment.
Looks good once the description is fixed.
…l-incorrect-behavior' into copilot/fix-loglevel-incorrect-behavior
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 6 pipeline(s). |
Why make this change?
Two
LogLevelbugs: Using theNoneLogLevel still emits someInformationmessages (version, config path, etc.), and using"Default"(capital D) as a key intelemetry.log-levelconfig crashes startup withNotSupportedException.What is this change?
All logs follow the LogLevel configuration
Program.cswhich where outputing some logs that where not following the LogLevel configuration from CLI and from configuration file.DynamicLogLevelProviderclass which allows the loggers in the host level to be updated after the RuntimeConfig is parsed and we know the LogLevel.StartupLogBufferclass which saves the logs that are created before we know the LogLevel, and sends them to their respective logger after the RuntimeConfig is parsed.Case-insensitive
"Default"key in configIsLoggerFilterValidusedstring.Equals(ordinal), so"Default"failed against the registered"default"filter.GetConfiguredLogLevelusedTryGetValue("default")(case-sensitive), silently ignoring"Default"keys.StringComparison.OrdinalIgnoreCase/ LINQFirstOrDefault.How was this tested?
ValidStringLogLevelFilters: added"Default"(capital D) data row to cover the case-insensitive validation fix.Sample Request(s)